import { IPSDEEndLogic } from './ipsdeend-logic';
import { IPSDELogic } from './ipsdelogic';
import { IPSDELogicParam } from './ipsdelogic-param';
import { PSDELogicNodeImpl } from './psdelogic-node-impl';

export class PSDEEndLogicImp extends PSDELogicNodeImpl implements IPSDEEndLogic {
  get dstFieldName(): string {
    return this.M.dstFieldName;
  }

  get rawValue(): string {
    return this.M.rawValue;
  }

  get rawValueStdDataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.rawValueStdDataType != null ? this.M.rawValueStdDataType : 0;
  }

  protected returnparam: IPSDELogicParam | null = null;

  getReturnParam(): IPSDELogicParam | null {
    if (this.returnparam != null) return this.returnparam;
    const value = this.M.getReturnParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.returnparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.returnparam;
  }

  get returnParam(): IPSDELogicParam | null {
    return this.getReturnParam();
  }

  getReturnParamMust(): IPSDELogicParam {
    const value = this.getReturnParam();
    if (value == null) {
      throw new Error('未指定返回参数');
    }
    return value;
  }

  get returnType(): 'NONEVALUE' | 'NULLVALUE' | 'SRCVALUE' | 'LOGICPARAM' | 'LOGICPARAMFIELD' | 'BREAK' {
    return this.M.returnType;
  }

  get cls(): string {
    return 'PSDEEndLogicImp';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEEndLogic') return true;
    return super.instanceof(cls);
  }
}
